#ifndef INITIALIZEPARAMETER_H
#define INITIALIZEPARAMETER_H

#include "d3dUtil.h"

#include "Light.h"

#include <sstream>
#include <fstream>

class InitializeParameter
{
public:
	InitializeParameter(void);
	~InitializeParameter(void);

	void			Read();
	void			Save();
	void			SaveCameraPara(const D3DXVECTOR3& pos,const D3DXVECTOR3& lookAt
									,const D3DXVECTOR3& up);

	D3DXVECTOR3		GetCameraPos();
	D3DXVECTOR3		GetCameraLookAt();
	D3DXVECTOR3		GetCameraUp();
	double			GetCameraSpeed();
	double			GetCameraPitchFactor();
	double			GetCameraYawFactor();
	double			GetCameraRollFactor();

	Light			GetLight();

	int				GetAILevel();

	int				OpenConsole();

/////////////////CEGUI/////////////////////////////////////////////////
	std::string		GetCEGUISchemesPath();
	std::string		GetCEGUIImagesetsPath();
	std::string		GetCEGUIFontsPath();
	std::string		GetCEGUILayoutsPath();
	std::string		GetCEGUILooknfeelPath();
	std::string		GetCEGUILuaScriptsPath();
	std::string		GetCEGUIXmlSchemasPath();
private:
//////////////////Camera////////////////////////////////////////////
	inline void		ReadCamera(std::fstream& paraFile);
	inline void		WriteD3DXVECTOR3( std::fstream& file,const D3DXVECTOR3& vec);
	inline void		WriteD3DXCOLOR(std::fstream& file , const D3DXCOLOR& color);
	inline void		WriteCamera(std::fstream& paraFile);
	
	inline void		SetCameraVector3(const std::string& name,float x,float y,float z);
	inline void		SetCameraFactor(const std::string& name , float factor);

/////////////////Light/////////////////////////////////////////////////
	inline void		ReadLight(std::fstream& paraFile);
	inline void		SetLightDirection(float x,float y,float z);
	inline void		SetLightAttribute(const std::string& name,float x,float y,float z,float a);
	inline void		WriteLight(std::fstream& paraFile);

////////////////AI////////////////////////////////////////////////////
	inline void		ReadAIParameter(std::fstream& paraFile);
	inline void		WriteAIParameter(std::fstream& paraFile);

///////////////Other//////////////////////////////////////////////////////
	inline void		ReadOtherParameter(std::fstream& paraFile);
	inline void		WriteOtherParameter(std::fstream& paraFile);

/////////////////CEGUI////////////////////////////////////////////////////
	inline void		ReadCEGUIParameter(std::fstream& paraFile);
	inline void		WriteCEGUIParameter(std::fstream& paraFile);

	inline void		SetCEGUIPath(const std::string& name,const std::string pathName);

private:
	D3DXVECTOR3		m_vec3CameraPosition;
	D3DXVECTOR3		m_vec3CameraLookAt;
	D3DXVECTOR3		m_vec3CameraUp;
	double			m_dfCameraSpeed;
	double			m_dfCameraYawFactor;
	double			m_dfCameraPitchFactor;
	double			m_dfCameraRollFactor;

	int				m_iAILevel;
	int				m_iOpenConsole;

	Light			m_Light;

	std::string		m_strSchemesPath;
	std::string		m_strImagesetsPath;
	std::string		m_strFontsPath;
	std::string		m_strLayoutsPath;
	std::string		m_strLooknfeelPath;
	std::string		m_strLuaScriptsPath;
	std::string		m_strXmlSchemasPath;
};


#endif


